<template>
  <TeamCardList :team-list="teamList"></TeamCardList>
</template>

<script setup lang='ts'>
import {useRouter} from "vue-router";
import {onMounted, ref} from "vue";
import {currentUser, TeamSearchMyCreate} from "../../services/api.ts";
import {showToast} from "vant";
import TeamCardList from '../../components/TeamCardList/index.vue'

const router = useRouter()
const teamList: API.TeamSearchResponse[] = ref({})
const user:API.User = ref({})
const getCurrentUser = async () => {
  const res = await currentUser()
  user.value = res.data;
}
onMounted(async () => {
  await getCurrentUser()
  const res = await TeamSearchMyCreate({
    params:{
      createUserId:user.id
    }
  })
  if (res.code === 0) {
    teamList.value = res?.data
  } else {
    showToast(res.description)
  }
})


</script>
<style scoped>

</style>